class Animals{
    public String name;;
    public int age;

    public Animals (String name, int age ) {
        this.age = age;
        this.name = name;
    }
    public void eat() {
        System.out.println(name + "正在吃饭");
    }
}

class Dog extends Animals{
    //public String silly;//傻 - 狗的属性
    //public String name = "大黄";
    public boolean silly;

    public Dog(String name, int age, boolean silly) {
        //1.先帮助父类初始化
        super(name, age);
        this.silly = silly;
    }
   public void  houseGuard() {
        System.out.println(super.name + "正在看家护院");
    }
}

class Cat extends Animals{
    //public String name = "小黑";
    public Boolean loveClean;//爱干净

    public Cat(String name, int age, boolean loveClean) {
        super(name, age);
        this.loveClean = loveClean;
    }
    public void catchMouse() {
        System.out.println(super.name + "正在抓老鼠");
        //super.eat();//调用父类的普通方法 - 静态方法不可调用
    }
}

public class Derived {
    public static void main(String[] args) {
        Dog dog = new Dog("大黄", 7, false);
        dog.houseGuard();

        Cat cat = new Cat("小黑", 5, false );
        cat.catchMouse();
    }
}

/*class Base {
    public void methodA() {
        System.out.println("Base中的methodA");
    }
    public void methodB() {
        System.out.println("Base中的methodB");
    }

}

public class  Derived extends Base{
    public void methodA(int a) {
        System.out.println("Test中的methodA");
    }
    public void methodB() {
        System.out.println("Test中的methodB");
    }

}*/
